package org.learn.tankgame3;

public class MyTank extends Tank {
    //定义一个shot对象，表示一个射击（线程）
    Shot shot = null;

    public MyTank(int x, int y) { super(x, y);}

    //射击
    public void shotEnemyTank() {
        //创建shot 对象
        switch (getDirect()){//得到myTank 的方向
            case 0 : //上
                shot = new Shot(getX() + 20 ,getY(),0);
                break;
            case 1 : //右
                shot = new Shot(getX() + 60 ,getY() + 20,1);
                break;
            case 2 : //下
                shot = new Shot(getX() + 20 ,getY()+60,2);
                break;
            case 3 : //左
                shot = new Shot(getX()  ,getY() +20,3);
                break;
        }
        //启动shot线程
        new Thread(shot).start();
    }
}
